FROM maven:3.3.9

MAINTAINER Huiqiang.yang <ayanghuiqiang@gmail.com>

ADD pom.xml /tmp/build/
RUN cd /tmp/build && mvn -q dependency:resolve
ADD src /tmp/build/src

#构建应用
RUN cd /tmp/build \
        && mvn -q -DskipTests=true package \
        #拷贝编译结果到指定目录
        && mv target/*.jar /app.jar \
        #清理编译痕迹
        && cd / && rm -rf /tmp/build

VOLUME /tmp
EXPOSE 8081

CMD echo "The application will start ........" && \
    java  -jar /app.jar